package com.addplus.townmall.server.api.mapper.town;

import com.addplus.townmall.server.api.model.town.Partner;
import com.addplus.townmall.server.api.model.town.expand.RecommendStore;
import com.addplus.townmall.server.api.utils.BaseAddMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 合伙人信息表 Mapper 接口
 * </p>
 *
 * @author zhangjiehang
 * @since 2018-08-27
 */
public interface PartnerMapper extends BaseAddMapper<Partner> {

    @Select("SELECT s.store_name,s.icon_path,s.store_introduction,s.store_backage_path,s.store_type,s.store_status,s.refuse_reason,p.id as recommend_id,p.flow_income_rate,p.shop_profit_rate from store s,partner_recommend_store p where p.partner_id=#{partnerId} AND p.store_id=s.id AND p.is_delete=0 ")
    List<RecommendStore> getRecommendShopListByPartnerId(Integer partnerId);

    @Select("SELECT s.store_name,s.icon_path,s.store_introduction,s.store_backage_path,s.store_type,s.store_status,s.refuse_reason,p.id as recommend_id,p.flow_income_rate,p.shop_profit_rate " +
            "from store s,partner_recommend_store p " +
            "where p.partner_id=#{id} AND p.store_id=s.id AND p.is_delete=0 And s.store_name=#{storename} ")
    List<RecommendStore> selectStoreListByName(@Param("storename")String storename, @Param("id")Integer id);
}
